package com.loyal.loyalerp.basedata.permission.util;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.loyal.loyalerp.basedata.action.mapper.GyActionMapper;

@Component
public class ActionJsonSerializer extends JsonSerializer<String>{

	@Autowired
	GyActionMapper gyActionMapper;

	@Override
	public void serialize(String str, JsonGenerator gen, SerializerProvider serializers)
			throws IOException, JsonProcessingException {
		gen.writeString(gyActionMapper.selectActionNameByActionCode(str).getActionname());
	}
	
	
}
